package cn.sc.allinpay.allfavour.base.connect.socket.connection;

import java.io.IOException;
import java.net.SocketAddress;

/**
 * 通讯接口
 * author：pany
 * on 2017/11/9 22:44
 */
public interface Connection {

    /**
     * @param localAddress
     * @throws IOException
     */
    void connect(SocketAddress localAddress) throws Exception;

    /**
     * 上送
     *
     * @param data 上送数据
     */
    void send(byte[] data) throws Exception;

    /**
     * 接收
     *
     * @return 接收数据
     * @throws IOException
     */
    byte[] receive() throws Exception;

    /**
     * 断开连接
     */
    void disconnect() throws Exception;
}
